<template>
	<view>
		<button @click="handleCakeData" class="cu-btn bg-cyan">
			转存数据
		</button>
		<button @click="page++">修改页码{{page}}</button>
		<button @click="bidIdx++">分类的编号:{{bidArr[bidIdx]}}</button>
	</view>
</template>

<script>
	import {courseGet,cakeBatch} from '../../api/cake.js'
	import {$http} from '../../utils/http.js'
	export default {
		data() {
			return {
				page:1,
				bidArr:[1,11,6,5],
				bidIdx:0
			};
		},
		async onLoad() {
			let res = await courseGet()
			console.log('数据包',res);
		},
		methods:{
			handleCakeData(){
				let {page,bidArr,bidIdx} = this
				let url = `/api/0434b49d1ac28f9d?cityId=641&page=${page}&bid=${bidArr[bidIdx]}`
				$http(url).then(res=>{ //爬取目标网站数据
					console.log(res);
					cakeBatch(res.data.data.list)  //转存
				})
			}
		}
	}
</script>

<style lang="scss">

</style>
